import 'package:flutter/material.dart';
import 'package:hkzf_flutter/config.dart';
import 'package:hkzf_flutter/scoped_model/city_model.dart';
import 'package:scoped_model/scoped_model.dart';
// 获取model的工具对象,用于操作model
class ScopedModelHelper {
  static T getModel<T extends Model>(BuildContext context) {
    return ScopedModel.of<T>(context,rebuildOnChange: true);
  }

  // 获取当前状态管理中的地区id
  static String? getAreaId(BuildContext context) {
    return ScopedModelHelper.getModel<CityModel>(context).city?.id ?? Config.availableCitys.first.id;
  }
}